package com.cake21.test.webtest;

import java.io.File;

import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import com.cake21.test.webtest.page.*;

/**
 * Simply DEMO!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Begin!" );
        
        /*Init one driver*/
        WebDriver driver = new FirefoxDriver();

        /*File screenshotFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);*/
        
        /*Init Index Page*/
        Index index = new Index(driver);
        /*Popup Window*/
        index.confirmPopUpBtn();
        
        /*Go To Login Page*/
        Login login = index.goLogin(); 
        		
        /*Enter UserName*/
        login.enterUser();
        /*Enter UserPwd*/
        login.enterPwd();
        /*Confirm Login*/
        login.pressLoginBtn();
        
        /*Cake List*/
        CakeList cakeList = new CakeList(driver);
        System.out.println("Cake Count: " + cakeList.getGoodsCount());
        
        /*Cake Detail*/
        Cake cakeDetail = cakeList.goCakeDetail();
        
        /*Switch Windows Handler*/
    	Utils.switchToWindow(driver, cakeDetail.getTitle());
        
    	/*CheckOut Page*/
        CheckOut cOut = cakeDetail.goCheckOut();
        cOut.selectShipTime();
        cOut.goSubmitOrder();
    }
    
    
}
